<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Aes Test Page</title>
    <!--<script src="/js/crypt_core.js"></script>-->
    <script src="/js/crypto-js.js"></script>
    <script src="/js/aes.js"></script>

    <!--<script src="/js/pad-nopadding.js"></script>-->

</head>
<body>
<script>
    var key = '37383234363661376461646131333435';
    console.log('密钥：', key);
    key = CryptoJS.enc.Hex.parse(key);
    //iv = CryptoJS.enc.Hex.parse("30313233343536373839414243444546")
    //console.log('偏移量:',CryptoJS.enc.Hex.stringify(iv));
    var src = "laoxu123";
    console.log('原字符串：', src);
    var enc = CryptoJS.AES.encrypt(src, key, {
        //iv:iv,
        mode: CryptoJS.mode.ECB,
        padding: CryptoJS.pad.Pkcs7
    })

    //console.log('加密:',enc.toString());
    var enced = enc.ciphertext.toString()
    console.log("加密：", enced);

    var dec = CryptoJS.AES.decrypt(CryptoJS.format.Hex.parse(enced), key, {
        //iv:iv,
        mode: CryptoJS.mode.ECB,
        padding: CryptoJS.pad.Pkcs7
    })
    console.log('解密:', CryptoJS.enc.Utf8.stringify(dec));
</script>
</body>
</html>